<!--
  @Created by zhuly8 zhuly8@yusys.com.cn on 2019-8-5 09:59:16.
  @updated by
  @description  应用系统管理
-->
<div id="dataStage">
	<yu-panel title="应用系统管理">
		<yu-xform related-table-name="refTable" form-type="search" v-model="searchformdata">
			<yu-xform-group :column="4">
				<yu-xform-item label="系统缩写" placeholder="系统缩写" ctype="input" name="appCode"></yu-xform-item>
				<yu-xform-item label="系统名称" placeholder="系统名称" ctype="input" name="appName"></yu-xform-item>
			</yu-xform-group>
		</yu-xform>
		<yu-toolBar>
			<yu-button @click="addFn" v-if="addFnButton">新增</yu-button>
			<yu-button @click="modifyFn" v-if="updateFnButton">修改</yu-button>
			<yu-button @click="deleteFN" v-if="deleteFnButton">删除</yu-button>
			<yu-button @click="importFn" v-if="importFnButton">导入</yu-button>
			<yu-button @click="exportViewFn" v-if="exportFnButton">导出</yu-button>
		</yu-toolBar>
		<div ref="tableBox" style="width: 100%;overflow: auto;">
			<yu-xtable ref="refTable" :height="tbHeight" row-number :data-url="dataUrl" :base-params="baseParam" selection-type="radio">
				<yu-xtable-column label="系统缩写" prop="appCode">
					<template slot-scope="scope">
						<a style="text-decoration:underline;color:#636CE4 " href="javascipt:void(0);" @click="viewFn(scope.row)">{{ scope.row.appCode }}</a>
					</template>
				</yu-xtable-column>
				<yu-xtable-column label="系统名称" prop="appName"></yu-xtable-column>
				<yu-xtable-column label="备注" prop="remark"></yu-xtable-column>
			</yu-xtable>
		</div>
	</yu-panel>

	<yu-xdialog title="集群代理选择" :visible.sync="objectTabVisible" width="800px">
		<el-form-q ref="queryObjRef" :field-data="queryObjFields" :buttons="queryObjButtons"></el-form-q>
		<yu-xtable ref="refObjUsedTable" row-number :data-url="objDataUrl" selection-type="checkbox">
			<!-- <yu-xtable-column label="集群代理标识" prop="serverId"></yu-xtable-column> -->
			<yu-xtable-column label="集群代理代码" prop="serverId"></yu-xtable-column>
			<yu-xtable-column label="服务名称" prop="serverName"></yu-xtable-column>
		</yu-xtable>
	</yu-xdialog>

	<yu-dialog :title="viewTitle" :visible.sync="dialogVisible">
	<!-- <el-tag type="warning" style="margin-left: 30px; margin-bottom: 10px;" width="100%"  middle>tips : 一个应用系统只能属于一个调度引擎，代理不能跨引擎选择。</el-tag> -->
		<yu-xform ref="refForm" v-model="formdata" label-width="120px">
			<yu-xform-group>
				<yu-xform-item label="系统缩写" ctype="input" name="appCode" :disabled="isReadOnly" rules="required" maxlength="64"></yu-xform-item>
				<yu-xform-item label="系统名称" ctype="input" name="appName" rules="required" maxlength="120"></yu-xform-item>
<!-- 				<yu-xform-item label="调度引擎" name="serverId" rules="required" ctype="yufp-agent-select" :params="propTableData" :agent-name="agentName"
				 @select-fn="selectAgentFn"></yu-xform-item> -->
				<yu-xform-item label="调度引擎" ctype="select" name="serverId" :options="serverIdData"></yu-xform-item>
			</yu-xform-group>

		</yu-xform>

		<el-form ref="serverTabForm" label-width="120px">
			<el-form-item label="集群代理:" require="true">
				
				<yu-toolBar>
					<el-button-group>
						<el-button @click="addFile">新增</el-button>
						<el-button @click="deleteFile">删除</el-button>
					</el-button-group>
				</yu-toolBar>
				<yu-xtable ref="refAgentPropTable" row-number :pageable="false" :data="propTableData" max-height="250" selection-type="checkbox">
<!-- 					<yu-xtable-column prop="agentId" v-if="false"></yu-xtable-column>
					<yu-xtable-column prop="srvPort" v-if="false"></yu-xtable-column> -->
					<!-- <yu-xtable-column label="集群代理标识" prop="agentId"></yu-xtable-column> -->
					<yu-xtable-column label="集群代理代码" prop="agentCode" :show-overflow-tooltip="true"></yu-xtable-column>
					<yu-xtable-column label="服务名称" prop="serverName" :show-overflow-tooltip="true"></yu-xtable-column>
					<yu-xtable-column label="备注" prop="remark" ctype="input" maxlength="240"></yu-xtable-column>
				</yu-xtable>
			</el-form-item>
		</el-form>
		<yu-xform ref="remarkRefForm" v-model="remarkFormData" label-width="120px">
			<yu-xform-item label="备注" ctype="textarea" name="remark" :rows="3" maxlength="240"></yu-xform-item>
		</yu-xform>
	
		<div class="yu-grpButton">
			<yu-button v-show="cancelBtnShow" @click="cancelFn">取消</yu-button>
			<yu-button v-show="saveBtnShow" type="primary" v-if="!saveDisabled" @click="saveFn" :disabled="saveDisabled">保存</yu-button>
			<yu-button v-show="saveBtnShow" type="info" v-if="saveDisabled" @click="saveFn" :disabled="saveDisabled">保存</yu-button>
		</div>
	</yu-dialog>

	<!--<yu-dialog title="应用系统导入" :visible.sync="upLoadDialogVisible"  :data-params="initFilesParams"  :data ="appUploadDatas"  width="400px">
        <yufp-upload-table ref="filesTable"  :data ="appUploadDatas" :before-upload="checkUpload" ></yufp-upload-table>
    </yu-dialog>-->

	<yu-dialog :title="exportTitle" :visible.sync="upLoadDialogVisible" width="400px">
		<!-- <yufp-upload-table ref="filesTable"  :data ="appUploadDatas" :before-upload="checkUpload" ></yufp-upload-table>-->
		<!-- <yu-upload
                :action="upLoadUrl"
                :before-upload="checkUpload"
                ref="upload"
                class="upload-demo"
                :file-list="appUploadDatas">

            <yu-button size="small" type="primary">点击上传</yu-button>
            &lt;!&ndash;<yu-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">同步服务器</yu-button>&ndash;&gt;
            <div slot="tip" class="el-upload__tip">只能上传xml文件，且不超过10M</div>
        </yu-upload>-->
		<yu-xform ref="refForm" v-model="upLoadDataformdata" label-width="120px">
			<yu-xform-group  >
				<yu-xform-item :label="importTypeName" ctype="select" name="importType" :options="importTypeOptions" rules="required" @change="changeImportType"></yu-xform-item>
				<yu-xform-item label="应用系统" ctype="select" name="appCode" :options="appCodeOptions" :hidden="!isAppImport" rules="required"  v-if="importMethod=='E'"></yu-xform-item>
				<yu-xform-item label="应用系统"   name="appCode"   :hidden="!isAppImport" rules="required"  v-if="importMethod=='I'"></yu-xform-item>

			</yu-xform-group>
		</yu-xform>
		<div v-if="importMethod=='I'">
			<yu-upload :action="upLoadUrl" :before-upload="checkUpload" :on-success="successUpload" :file-list="appUploadDatas">
				<yu-button size="big" style="margin-left: 80px" type="primary">点击上传</yu-button>
				<div slot="tip" style="margin-left: 60px" class="el-upload__tip">只能上传xml文件，且不超过100M</div>
			</yu-upload>
		</div>
		<div v-if="importMethod=='E'">
			<div class="yu-grpButton">
				<yu-button size="big" type="primary" @click="exportFn">导出</yu-button>
				<yu-button size="big" @click="closeImpWindow">关闭</yu-button>
			</div>
		</div>
	</yu-dialog>


</div>